package com.qdlc.p2p.manage.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.BorrowCollectionService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.BorrowCollectionModel;

/**
 * 借贷管理-待收信息管理
 * 
 * @author xx
 * @version 2.0
 * @since 2014年4月17日
 */
public class ManageCollectionAction extends BaseAction<BorrowCollectionModel> implements ModelDriven<BorrowCollectionModel> {

	BorrowCollectionModel model = new BorrowCollectionModel();

	public BorrowCollectionModel getModel() {
		return model;
	}

	@Resource
	private BorrowCollectionService borrowCollectionService;

	private Map<String, Object> data = new HashMap<String, Object>();

	/**
	 * 待收信息展示
	 * 
	 * @return
	 */
	@Action("/modules/loan/collection/collectionManager")
	public String collectionManager() throws Exception {

		return "collectionManager";
	}

	/**
	 * 待收信息列表
	 * 
	 * @return
	 */
	@Action("/modules/loan/collection/collectionList")
	public void collectionList() throws Exception {
		model.setSize(paramInt("rows"));
		PageDataList<BorrowCollectionModel> list = borrowCollectionService.list(model);
		data.put("total", list.getPage().getTotal());
		data.put("rows", list.getList());
		printJson(getStringOfJpaObj(data));
	}
}
